﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LibWithExtMethods {
	public class ClassOne {
		public int SomeValue;

	    public string ConcatValue(string postfix)
	    {
	        return SomeValue.ToString() + postfix;
	    }

	    public static void Execute()
        {
            var obj = new ClassOne();
            obj.SomeValue = 123;
            Console.WriteLine("Value is {0}", obj.SomeExtensionMethod());
        }
        public static void CallStaticMethod(string typeName, string methodName, object[] methodParameters)
        {
            for (int i = 0; i < methodParameters.Length; i++)
            {
                Console.WriteLine(methodParameters[i].GetType().Name);
                Console.WriteLine(methodParameters[i].ToString());
            }
        }

        public static object CallMethod(object obj, string methodName, object[] methodParameters)
        {
            var methodInfo = obj.GetType().GetMethod(methodName);
            return methodInfo.Invoke(obj, methodParameters);
        }
    }

	public static class ClassOneExtensions {
		public static string SomeExtensionMethod (this ClassOne obj)
		{
			return obj.SomeValue.ToString ();
		}
	}
}
